package com.zdw.demo.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zdw.common.parent.JSONResult;
import com.zdw.demo.service.WechatPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class WechatXxlJob {

    @Autowired
    private WechatPayService wechatPayService;

    @XxlJob("wechatJob")
    public ReturnT<String> demoJob(Map<String, String> map) throws Exception {
        JSONResult jsonResult = wechatPayService.notifyOrder();
        XxlJobHelper.log(jsonResult.isSuccess()?"wechatJob定时器执行成功:wechatJob":"wechatJob定时器执行失败:wechatJob");
        return ReturnT.SUCCESS;
    }

}
